package com.cqie.config;

import com.cqie.interceptor.TokenInterceptor;
import com.cqie.util.RedisUtils;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 注册拦截器

        registry.addInterceptor(new TokenInterceptor())
                // 指定拦截路径
                .addPathPatterns("/**")
                // 指定排除路径
                .excludePathPatterns("/api/v1.0/doctorsLogin/**","/api/v1/doctorsLogin/**", "/css/**", "/js/**","/api" +
                                "/v1.0/patientLogin/**","/api/v1/patientLogin/**",
                        "/images/**","/swagger-ui/**","/v3/**");
    }
}